/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.cliente;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import model.contato.Contato;
import model.endereco.Endereco;
import model.heranca.Pessoa;
import model.perfil.Perfil;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 *
 * @author Marcos
 */
@Entity
@Table(name = "cliente", schema = "sistemavendas")
public class Cliente extends Pessoa implements Serializable{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int codigo;
    @Temporal(TemporalType.DATE)
    @Column(name = "data_cadastro", nullable = true)
    private Date dataCadastro;
    private Endereco endereco;
    private Contato contato;
    @OneToOne(mappedBy = "cliente")
    @Cascade(CascadeType.ALL)
    private Perfil perfil;

    public Perfil getPerfil() {
        return perfil;
    }

    public void setPerfil(Perfil perfil) {
        this.perfil = perfil;
    }
    
    
    
    
    
    public Cliente(){
        this.endereco = new Endereco();
        this.contato = new Contato();
        this.perfil = new Perfil();
    }
    
    public Endereco getEndereco(){
        return endereco;
    }
    
    public Contato getContato(){
        return contato;
    }

    public int getCodigo() {
        return codigo;
    }

    public void setCodigo(int codigo) {
        this.codigo = codigo;
    }

    public Date getDataCadastro() {
        return dataCadastro;
    }

    public void setDataCadastro(Date dataCadastro) {
        this.dataCadastro = dataCadastro;
    }
}
